package com.soft.controller;

import com.soft.pojo.Jianli;
import com.soft.service.EmpRecordService;
import com.soft.utils.Result;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ruoxi
 * @create 2021-12-29 11:24
 */
@WebServlet("/addResume")
public class AddResumeServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        String name = req.getParameter("name");
        String sex = req.getParameter("sex");
        String birth = req.getParameter("birth");
        String mianmao = req.getParameter("mianmao");
        String collage = req.getParameter("collage");
        String expensive = req.getParameter("expensive");
        String zhengshu = req.getParameter("zhengshu");
        String job = req.getParameter("job");
        String dName = req.getParameter("dName");

        Jianli resume = new Jianli();
        resume.setName(name);
        resume.setSex(sex);
        resume.setBirth(birth);
        resume.setMianmao(mianmao);
        resume.setCollage(collage);
        resume.setExpensive(expensive);
        resume.setZhengshu(zhengshu);
        resume.setJob(job);
        resume.setdName(dName);

        EmpRecordService empRecordService = new EmpRecordService();
        Result result = empRecordService.addEmpRecord(resume);
        req.setAttribute("addResumeMsg",result);
        req.getRequestDispatcher("showAllResumeCheckByPage").forward(req,resp);
    }
}
